﻿using AJWPFAdmin.Core.CommonEntity;
using AJWPFAdmin.Core.Enums;
using AJWPFAdmin.Core.Excel;
using AJWPFAdmin.Core.Models;
using AJWPFAdmin.Core.Utils;
using AJWPFAdmin.Core.Validation;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AJWPFAdmin.Core.Models.EF.Tables
{
    /// <summary>
    /// 车辆记录表
    /// </summary>
    [Comment("车辆记录表")]
    public partial class Car : CommonTableEntity
    {
        /// <summary>
        /// 车牌号
        /// </summary>
        [Comment("车牌号")]
        [Display(Name = "车牌号")]
        [Required]
        [MaxLength(120)]
        [AJExportField(ColumnName = "车牌号")]
        public string CarNo { get; set; }

        /// <summary>
        /// 卡号,用于读卡器识别车牌
        /// </summary>
        [Comment("卡号,用于读卡器识别车牌")]
        [MaxLength(100)]
        [Display(Name = "卡号")]
        [AJExportField(ColumnName = "卡号")]
        public string CardNo { get; set; }

        /// <summary>
        /// 号牌颜色
        /// </summary>
        [Comment("号牌颜色")]
        [Display(Name = "号牌颜色")]
        [AJExportField(ColumnName = "号牌颜色")]
        public CarPlateColor PlateColor { get; set; }

        /// <summary>
        /// 车辆类型Id, CarType.Id
        /// </summary>
        [Comment("车辆类型Id")]
        public long TypeId { get; set; }

        /// <summary>
        /// 车辆类型名称,  CarType.Name
        /// </summary>
        [Comment("车辆类型名称")]
        [Required]
        [MaxLength(50)]
        [Display(Name = "车辆类型")]
        [AJExportField(ColumnName = "车辆类型")]
        public string TypeName { get; set; }

        /// <summary>
        /// 货车车辆类型编码, SystemDictionary.Code
        /// </summary>
        [Comment("货车车辆类型编码")]
        [MaxLength(20)]
        [AJExportField(ColumnName = "货车类型编码")]
        public string TruckTypeCode { get; set; }

        /// <summary>
        /// 货车车辆类型名称,  SystemDictionary.Name
        /// </summary>
        [Comment("货车车辆类型名称")]
        [Display(Name = "货车类型")]
        [MaxLength(20)]
        [AJExportField(ColumnName = "货车类型")]
        public string TruckTypeName { get; set; }

        /// <summary>
        /// 车辆品牌型号
        /// </summary>
        [Comment("车辆品牌型号")]
        [Display(Name = "车辆品牌型号")]
        [MaxLength(50)]
        [AJExportField(ColumnName = "品牌型号")]
        public string CarBrandModel { get; set; }

        /// <summary>
        /// 燃料类型编码, SystemDictionary.Code
        /// </summary>
        [Comment("燃料类型编码")]
        [MaxLength(20)]
        [AJExportField(ColumnName = "燃料类型编码")]
        public string FuelTypeCode { get; set; }

        /// <summary>
        /// 燃料类型名称,  SystemDictionary.Name
        /// </summary>
        [Comment("燃料类型名称")]
        [Display(Name = "燃料类型")]
        [MaxLength(20)]
        [AJExportField(ColumnName = "燃料类型")]
        public string FuelTypeName { get; set; }

        /// <summary>
        /// 有效期, 过了有效期自动变为临时车
        /// </summary>
        [Comment("有效期")]
        [Display(Name = "有效期")]
        [AJExportField(ColumnName = "有效期")]
        public DateTime? ExpireDate { get; set; }

        /// <summary>
        /// 排放标准
        /// </summary>
        [Comment("排放标准")]
        [Display(Name = "排放标准")]
        [AJExportField(ColumnName = "排放标准")]
        public EmissionStandard EmissionStandard { get; set; }

        /// <summary>
        /// 联网状态
        /// </summary>
        [Comment("联网状态")]
        [Display(Name = "联网状态")]
        [AJExportField(ColumnName = "联网状态")]
        public bool NetworkingStatus { get; set; }

        /// <summary>
        /// 使用性质编号
        /// </summary>
        [Comment("使用性质编号")]
        [Display(Name = "使用性质编号")]
        [MaxLength(20)]
        [AJExportField(ColumnName = "使用性质编号")]
        public string UsageDescCode { get; set; }

        /// <summary>
        /// 使用性质名称
        /// </summary>
        [Comment("使用性质类型名称")]
        [Display(Name = "使用性质名称")]
        [MaxLength(100)]
        [AJExportField(ColumnName = "使用性质")]
        public string UsageDescription { get; set; }

        /// <summary>
        /// 发动机号
        /// </summary>
        [Comment("发动机号")]
        [Display(Name = "发动机号")]
        [MaxLength(50)]
        [AJExportField(ColumnName = "发动机号")]
        public string EngineNo { get; set; }

        /// <summary>
        /// 发动机型号
        /// </summary>
        [Comment("发动机型号")]
        [Display(Name = "发动机型号")]
        [AJExportField(ColumnName = "发动机型号")]
        public string EngineModel { get; set; }

        /// <summary>
        /// 发动机生产厂
        /// </summary>
        [Comment("发动机生产厂")]
        [Display(Name = "发动机生产厂")]
        [AJExportField(ColumnName = "发动机生产厂")]
        public string EngineManufacturer { get; set; }

        /// <summary>
        /// 铭牌图片Json数组文件路径
        /// </summary>
        [Comment("铭牌图片Json数组文件路径")]
        [Display(Name = "铭牌")]
        [AJExportField(ColumnName = "铭牌", IsImage = true)]
        public  string Nameplate { get; set; }

        /// <summary>
        /// 发动机铭牌图片Json数组文件路径
        /// </summary>
        [Comment("发动机铭牌图片Json数组文件路径")]
        [Display(Name = "发动机铭牌")]
        [AJExportField(ColumnName = "发动机铭牌", IsImage = true)]
        public string EngineNameplate { get; set; }

        /// <summary>
        /// 机械环保信息标签图片Json数组文件路径
        /// </summary>
        [Comment("机械环保信息标签图片Json数组文件路径")]
        [Display(Name = "机械环保信息标签")]
        [AJExportField(ColumnName = "机械环保信息标签", IsImage = true)]
        public string MachineEnvProtectionLabel { get; set; }

        /// <summary>
        /// 排放阶段图片Json数组文件路径
        /// </summary>
        [Comment("排放阶段图片Json数组文件路径")]
        [Display(Name = "排放阶段图片")]
        [AJExportField(ColumnName = "排放阶段图片", IsImage = true)]
        public string EmissionStandardImages { get; set; }

        /// <summary>
        /// 车辆识别代码VIN
        /// </summary>
        [MaxLength(100)]
        [Comment("车辆识别代码VIN")]
        [Display(Name = "车辆识别代码VIN")]
        [AJExportField(ColumnName = "VIN")]
        public string VIN { get; set; }

        /// <summary>
        /// 机械环保代码(产品识别码)PIN
        /// </summary>
        [MaxLength(100)]
        [Comment("机械环保代码(产品识别码)PIN")]
        [Display(Name = "机械环保代码")]
        [AJExportField(ColumnName = "PIN")]
        public string PIN { get; set; }

        /// <summary>
        /// 环保登记编码
        /// </summary>
        [MaxLength(100)]
        [Comment("环保登记编码")]
        [Display(Name = "环保登记编码")]
        [AJExportField(ColumnName = "环保登记编码")]
        public string EnvRegCode { get; set; }

        /// <summary>
        /// 注册日期
        /// </summary>
        [Comment("注册日期")]
        [Display(Name = "注册日期")]
        [AJExportField(ColumnName = "注册日期")]
        public DateTime? RegDate { get; set; }

        /// <summary>
        /// 生产日期
        /// </summary>
        [Comment("生产日期")]
        [Display(Name = "生产日期")]
        [AJExportField(ColumnName = "生产日期")]
        public DateTime? ProductionDate { get; set; }

        /// <summary>
        /// 机械生产日期
        /// </summary>
        [Comment("机械生产日期")]
        [Display(Name = "机械生产日期")]
        [AJExportField(ColumnName = "机械生产日期")]
        public DateTime? MechanicalProdDate { get; set; }

        /// <summary>
        /// 机械型号
        /// </summary>
        [Comment("机械型号")]
        [Display(Name = "机械型号")]
        [AJExportField(ColumnName = "机械型号")]
        public string MachineModel { get; set; }

        /// <summary>
        /// 车辆所有人(单位)
        /// </summary>
        [Comment("车辆所有人(单位)")]
        [Display(Name = "所有人(单位)")]
        [MaxLength(128)]
        [AJExportField(ColumnName = "有人(单位)")]
        public string Owner { get; set; }

        /// <summary>
        /// 机械种类
        /// </summary>
        [Comment("机械种类")]
        [Display(Name = "机械种类")]
        [AJExportField(ColumnName = "机械种类")]
        public MachineType? MachineType { get; set; }

        /// <summary>
        /// 车队名称
        /// </summary>
        [Comment("车队名称")]
        [Display(Name = "车队名称")]
        [MaxLength(50)]
        [AJExportField(ColumnName = "车队名称")]
        public string TeamName { get; set; }

        /// <summary>
        /// 行驶证图片路径json数组字符串
        /// </summary>
        [Comment("行驶证图片路径json数组字符串")]
        [Display(Name = "行驶证")]
        [AJExportField(ColumnName = "行驶证", IsImage = true)]
        public string VehicleLicense { get; set; }

        /// <summary>
        /// 随车清单路径json数组字符串
        /// </summary>
        [Comment("随车清单路径json数组字符串")]
        [Display(Name = "随车清单")]
        [AJExportField(ColumnName = "随车清单", IsImage = true)]
        public string Attachments { get; set; }

        /// <summary>
        /// 车辆种类
        /// </summary>
        [Comment("车辆种类")]
        [Display(Name = "车辆种类")]
        [AJExportField(ColumnName = "车辆种类")]
        public VehicleType VehicleType { get; set; }

        /// <summary>
        /// 最新年检日期
        /// </summary>
        [Comment("最新年检日期")]
        [Display(Name = "最新年检日期")]
        [AJExportField(ColumnName = "最新年检日期")]
        public DateTime? LatestInspectionDate { get; set; }

        /// <summary>
        /// 是否已同步
        /// </summary>
        [Comment("是否已同步")]
        [Display(Name = "是否同步")]
        [AJNotCopyField]
        [AJExportField(ColumnName = "是否同步")]
        public bool Synchronized { get; set; }

        /// <summary>
        /// 同步结果,备用
        /// </summary>
        [Comment("同步结果,备用")]
        [Display(Name = "同步结果")]
        [AJNotCopyField]
        [AJExportField(ColumnName = "同步结果")]
        public string SyncResult { get; set; }

        /// <summary>
        /// 进厂物资名称
        /// </summary>
        [Comment("进厂物资名称")]
        [MaxLength(200)]
        [Display(Name = "进厂物资名称")]
        [AJExportField(ColumnName = "进厂物资名称")]
        public string InGoodsName { get; set; }

        /// <summary>
        /// 进厂物资运输量
        /// </summary>
        [Comment("进厂物资运输量")]
        [Display(Name = "进厂物资运输量")]
        [Precision(18, 2)]
        [AJExportField(ColumnName = "进厂物资运输量")]
        public decimal InGoodsVolume { get; set; }

        /// <summary>
        /// 出厂物资名称
        /// </summary>
        [Comment("出厂物资名称")]
        [MaxLength(200)]
        [Display(Name = "出厂物资名称")]
        [AJExportField(ColumnName = "出厂物资名称")]
        public string OutGoodsName { get; set; }

        /// <summary>
        /// 出厂物资运输量
        /// </summary>
        [Comment("出厂物资运输量")]
        [Display(Name = "出厂物资运输量")]
        [Precision(18,2)]
        [AJExportField(ColumnName = "出厂物资运输量")]
        public decimal OutGoodsVolume { get; set; }

        /// <summary>
        /// 车辆图片路径json数组字符串
        /// </summary>
        [Comment("车辆图片路径json数组字符串")]
        [Display(Name = "车辆图片")]
        [AJExportField(ColumnName = "车辆图片", IsImage = true)]
        public string CarImage { get; set; }

        /// <summary>
        /// 核定载重质量
        /// </summary>
        [Comment("核定载重质量")]
        [Display(Name = "核定载重质量")]
        [AJExportField(ColumnName = "核定载重质量")]
        [StringLength(20)]
        [MaxLength(20, ErrorMessage = "{0}超长:{1}")]
        public string VerifiedLoadWeight { get; set; }

        /// <summary>
        /// 准牵引总质量
        /// </summary>
        [Comment("准牵引总质量")]
        [Display(Name = "准牵引总质量")]
        [AJExportField(ColumnName = "准牵引总质量")]
        [StringLength(20)]
        [MaxLength(20, ErrorMessage = "{0}超长:{1}")]
        public string PermittedTowingWeight { get; set; }

        /// <summary>
        /// 是否企业自有车辆
        /// </summary>
        [Comment("是否企业自有车辆")]
        [Display(Name = "是否企业自有车辆")]
        [AJExportField(ColumnName = "是否企业自有车辆")]
        [StringLength(10)]
        [MaxLength(10, ErrorMessage = "{0}超长:{1}")]
        public string IsOwnedByCompany { set; get; }
    }
}
